package com.wh.hotel.enums.strategy;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wenhao
 */
@Getter
@AllArgsConstructor
public enum PriceGapTypeEnum {
    ABSOLUTE(0, "绝对值"),

    PERCENT(1, "百分比"),
    ;

    private final int code;
    private final String desc;

    public static PriceGapTypeEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (PriceGapTypeEnum priceGapTypeEnum : PriceGapTypeEnum.values()) {
            if (priceGapTypeEnum.getCode() == code) {
                return priceGapTypeEnum;
            }
        }
        return null;
    }
}
